#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.67])
AC_INIT([GodCalc], [1.0.0], [023389@comp.uems.br], [prova3], [http://moodle.alcionesytes.net])
AM_INIT_AUTOMAKE([gnu 1.11 -Wall dist-xz])
AC_CONFIG_MACRO_DIR([m4])
m4_pushdef([AC_INCLUDES_DEFAULT], [$1])
AC_COPYRIGHT([ACEH])
AC_REVISION([$Revision: 1.0.0 $])

AC_CONFIG_SRCDIR([src/main.C])
AC_CONFIG_HEADERS([config.h])

AC_CANONICAL_HOST
#Testando plataforma
AC_MSG_NOTICE([Plataforma: $host_os])
case "$host_os" in
	linux*)
		WIN_LD=""
		;;
	*)
		WIN_LD="-mwindows"
		;;
esac
AC_SUBST([WIN_LD])

AC_CANONICAL_HOST

LIBEX
LIBBANCOPG

# Checks for programs.
AC_PROG_CXX
AC_LANG([C++])
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_CHECK_PROGS([LS], [ls], [/bin/ls], [$PATH])

# Checks for libraries.
AC_CHECK_LIB([m], [powf])

PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.10])

# Checks for header files.
AC_CHECK_HEADERS([iostream vector cmath])

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_TYPES([struct NOMES *])
AC_CHECK_TYPES([struct tm *])
AC_STRUCT_TM

# Checks for library functions.

#Definicoes Locais
AC_DEFINE([PRJ], [1], [Simbolo Local])
AC_DEFINE([ARQUIVO], [src/texto.txt], [Texto para pesquisa])
AC_DEFINE([CONF], ["conf/db.conf"], [Caminho do arquivo de configuraçao do banco de dados])

AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_SUBST([AM_LDADD])

#Definição do Cabeçalho
AH_TOP([
#ifndef __CONFIG_H__
#define __CONFIG_H__ 1

#if defined(__WIN32__) || defined(__WIN__)
	#include <windows.h>
#endif
])

#Definição de Rodapé
AH_BOTTOM([
#ifdef HAVE_IOSTREAM
	#include <iostream>
#endif
#ifdef HAVE_VECTOR
	#include <vector>
#endif
#ifdef HAVE_CMATH
	#include <cmath>
#endif
#ifdef HAVE_STDIO_H
	#include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H
	# include <sys/types.h>
          #endif
          #ifdef HAVE_SYS_STAT_H
          # include <sys/stat.h>
          #endif
          #ifdef STDC_HEADERS
          # include <stdlib.h>
          # include <stddef.h>
          #else
          # ifdef HAVE_STDLIB_H
          #  include <stdlib.h>
          # endif
          #endif
          #ifdef HAVE_STRING_H
          # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
          #  include <memory.h>
          # endif
          # include <string.h>
          #endif
          #ifdef HAVE_STRINGS_H
          # include <strings.h>
          #endif
          #ifdef HAVE_INTTYPES_H
          # include <inttypes.h>
          #endif
          #ifdef HAVE_STDINT_H
          # include <stdint.h>
          #endif
          #ifdef HAVE_UNISTD_H
          # include <unistd.h>
          #endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#endif
])

AC_MSG_RESULT([Configurado com Sucesso!])

AC_CONFIG_FILES([conf/db.conf Makefile src/Makefile docs/Makefile conf/Makefile])


#Depencias estáticas (Bibliotecas)
AC_CONFIG_SUBDIRS([libex libbancopg ])

AC_OUTPUT
